<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Page extends CI_Controller {

	public function index(){
	   $this->load->model('Pages', null, true);
       $data['Pages'] = $this->Pages->getList();
	   $this->load->view('page/index', $data);
	}
    
    /**
     * edit save config id
     * @author tien.nguyen
     */
    public function edit($pageId){
        $this->load->model('Pages', null, true);
        
        if($this->input->post()){
            $data = $this->input->post();
            if($this->Pages->edit($data, $pageId)){
                redirect(base_url().'page/index.html');
            }
        }
        
        //get page
        $data['Page'] = $this->Pages->getPage($pageId);
        $this->load->view('page/edit', $data);
    }
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */